﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Business.Entity;
namespace Chenxin.Lib.Business.BLL
{
    /// <summary>
    /// 业务逻辑类t_Intention_DeliverLogs 的摘要说明。
    /// </summary>
    public class t_Intention_DeliverLogs
    {
        public t_Intention_DeliverLogs()
        { }
        #region  成员方法
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs model)
        {
            Chenxin.Lib.Business.DAL.t_Intention_DeliverLogs.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs model)
        {
            Chenxin.Lib.Business.DAL.t_Intention_DeliverLogs.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(Guid RecordId)
        {

            Chenxin.Lib.Business.DAL.t_Intention_DeliverLogs.Delete(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs GetModel(Guid RecordId)
        {

            return Chenxin.Lib.Business.DAL.t_Intention_DeliverLogs.GetModel(RecordId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public string GetCode(Guid IntentionId)
        {
            return Chenxin.Lib.Business.DAL.t_Intention_DeliverLogs.GetCode(IntentionId);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.t_Intention_DeliverLogs.GetList(strWhere);
        }
        
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.Business.DAL.t_Intention_DeliverLogs.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs> modelList = new List<Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.Business.Entity.t_Intention_DeliverLogs();
                    if (dt.Rows[n]["RecordId"].ToString() != "")
                    {
                        model.RecordId = new Guid(dt.Rows[n]["RecordId"].ToString());
                    }
                    if (dt.Rows[n]["IntentionId"].ToString() != "")
                    {
                        model.IntentionId = new Guid(dt.Rows[n]["IntentionId"].ToString());
                    }
                    model.IntentionCode = dt.Rows[n]["IntentionCode"].ToString();
                    if (dt.Rows[n]["DeliverTime"].ToString() != "")
                    {
                        model.DeliverTime = DateTime.Parse(dt.Rows[n]["DeliverTime"].ToString());
                    }
                    if (dt.Rows[n]["DeliverEmpId"].ToString() != "")
                    {
                        model.DeliverEmpId = new Guid(dt.Rows[n]["DeliverEmpId"].ToString());
                    }
                    model.DeliverEmp = dt.Rows[n]["DeliverEmp"].ToString();
                    if (dt.Rows[n]["DeliverDepartId"].ToString() != "")
                    {
                        model.DeliverDepartId = new Guid(dt.Rows[n]["DeliverDepartId"].ToString());
                    }
                    model.DeliverDepart = dt.Rows[n]["DeliverDepart"].ToString();
                    if (dt.Rows[n]["DeliverCompanyId"].ToString() != "")
                    {
                        model.DeliverCompanyId = new Guid(dt.Rows[n]["DeliverCompanyId"].ToString());
                    }
                    model.DeliverCompany = dt.Rows[n]["DeliverCompany"].ToString();
                    if (dt.Rows[n]["DeliverCityId"].ToString() != "")
                    {
                        model.DeliverCityId = new Guid(dt.Rows[n]["DeliverCityId"].ToString());
                    }
                    model.DeliverCity = dt.Rows[n]["DeliverCity"].ToString();
                    if (dt.Rows[n]["ReceiveEmpId"].ToString() != "")
                    {
                        model.ReceiveEmpId = new Guid(dt.Rows[n]["ReceiveEmpId"].ToString());
                    }
                    model.ReceiveEmp = dt.Rows[n]["ReceiveEmp"].ToString();
                    if (dt.Rows[n]["ReceiveDepartId"].ToString() != "")
                    {
                        model.ReceiveDepartId = new Guid(dt.Rows[n]["ReceiveDepartId"].ToString());
                    }
                    model.ReceiveDepart = dt.Rows[n]["ReceiveDepart"].ToString();
                    if (dt.Rows[n]["ReceiveCompanyId"].ToString() != "")
                    {
                        model.ReceiveCompanyId = new Guid(dt.Rows[n]["ReceiveCompanyId"].ToString());
                    }
                    model.ReceiveCompany = dt.Rows[n]["ReceiveCompany"].ToString();
                    if (dt.Rows[n]["ReceiveCityId"].ToString() != "")
                    {
                        model.ReceiveCityId = new Guid(dt.Rows[n]["ReceiveCityId"].ToString());
                    }
                    model.ReceiveCity = dt.Rows[n]["ReceiveCity"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return Chenxin.Lib.Business.DAL.t_Intention_DeliverLogs.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

